/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.jcdev.coolrss.model.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author carlos
 */
@Entity
@Table(name = "ENTRY")
@NamedQueries({
    @NamedQuery(name = "Entry.findAll", query = "SELECT e FROM Entry e"),
    @NamedQuery(name = "Entry.findByEntryId", query = "SELECT e FROM Entry e WHERE e.entryId = :entryId"),
    @NamedQuery(name = "Entry.findByEntryTitle", query = "SELECT e FROM Entry e WHERE e.entryTitle = :entryTitle"),
    @NamedQuery(name = "Entry.findByEntryLink", query = "SELECT e FROM Entry e WHERE e.entryLink = :entryLink"),
    @NamedQuery(name = "Entry.findByEntryAuthor", query = "SELECT e FROM Entry e WHERE e.entryAuthor = :entryAuthor"),
    @NamedQuery(name = "Entry.findByEntryPublishedDate", query = "SELECT e FROM Entry e WHERE e.entryPublishedDate = :entryPublishedDate"),
    @NamedQuery(name = "Entry.findByEntryUpdatedDate", query = "SELECT e FROM Entry e WHERE e.entryUpdatedDate = :entryUpdatedDate"),
    @NamedQuery(name = "Entry.findByEntryStatus", query = "SELECT e FROM Entry e WHERE e.entryStatus = :entryStatus")})
public class Entry implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ENTRY_ID")
    private Integer entryId;
    @Column(name = "ENTRY_TITLE")
    private String entryTitle;
    @Lob
    @Column(name = "ENTRY_DESCRIPTION")
    private String entryDescription;
    @Basic(optional = false)
    @Column(name = "ENTRY_LINK")
    private String entryLink;
    @Column(name = "ENTRY_AUTHOR")
    private String entryAuthor;
    @Column(name = "ENTRY_PUBLISHED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date entryPublishedDate;
    @Column(name = "ENTRY_UPDATED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date entryUpdatedDate;
    @Column(name = "ENTRY_STATUS")
    private Character entryStatus;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "entryId")
    private List<Description> descriptionList;
    @JoinColumn(name = "FEED_LINK", referencedColumnName = "FEED_LINK")
    @ManyToOne(optional = false)
    private Feed feedLink;

    public Entry() {
    }

    public Entry(Integer entryId) {
        this.entryId = entryId;
    }

    public Entry(Integer entryId, String entryLink) {
        this.entryId = entryId;
        this.entryLink = entryLink;
    }

    public Integer getEntryId() {
        return entryId;
    }

    public void setEntryId(Integer entryId) {
        this.entryId = entryId;
    }

    public String getEntryTitle() {
        return entryTitle;
    }

    public void setEntryTitle(String entryTitle) {
        this.entryTitle = entryTitle;
    }

    public String getEntryDescription() {
        return entryDescription;
    }

    public void setEntryDescription(String entryDescription) {
        this.entryDescription = entryDescription;
    }

    public String getEntryLink() {
        return entryLink;
    }

    public void setEntryLink(String entryLink) {
        this.entryLink = entryLink;
    }

    public String getEntryAuthor() {
        return entryAuthor;
    }

    public void setEntryAuthor(String entryAuthor) {
        this.entryAuthor = entryAuthor;
    }

    public Date getEntryPublishedDate() {
        return entryPublishedDate;
    }

    public void setEntryPublishedDate(Date entryPublishedDate) {
        this.entryPublishedDate = entryPublishedDate;
    }

    public Date getEntryUpdatedDate() {
        return entryUpdatedDate;
    }

    public void setEntryUpdatedDate(Date entryUpdatedDate) {
        this.entryUpdatedDate = entryUpdatedDate;
    }

    public Character getEntryStatus() {
        return entryStatus;
    }

    public void setEntryStatus(Character entryStatus) {
        this.entryStatus = entryStatus;
    }

    public List<Description> getDescriptionList() {
        return descriptionList;
    }

    public void setDescriptionList(List<Description> descriptionList) {
        this.descriptionList = descriptionList;
    }

    public Feed getFeedLink() {
        return feedLink;
    }

    public void setFeedLink(Feed feedLink) {
        this.feedLink = feedLink;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (entryId != null ? entryId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Entry)) {
            return false;
        }
        Entry other = (Entry) object;
        if ((this.entryId == null && other.entryId != null) || (this.entryId != null && !this.entryId.equals(other.entryId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.jcdev.coolrss.model.entity.Entry[entryId=" + entryId + "]";
    }

}
